<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI 排序（Sortable） - 连接列表</title>
  <link rel="stylesheet" href="jquery-ui-1.10.4.custom/css/base/jquery-ui-1.10.4.custom.min.css" />
  <script type="text/javascript" src="../jQuery-2.1.4.min.js" ></script>
  <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script>
  <link rel="stylesheet" href="jqueryui/style.css">
  <style>
  #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0 0 2.5em; float: left; margin-right: 10px; }
  #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
  </style>
  <script>
  $(function() {
    $( "ul" ).sortable({
      connectWith: ".connectedSortable"
    }).disableSelection();
    
    
    $( "ul" ).bind('DOMNodeInserted', function(e) {
		var h = 240;
		var w = $(this).width();
		var n = $(this).find("li").length;
		n=n-1;
//		console.log($(this).attr("id"))
//		$(this).find("li").each(function(i,e){
//			var v = $(e).html();
//			console.log(v) 
//		});
		$(this).height(h)
		$(this).find("li").height(h/n-10)
		console.log("-----------------")
//		console.log($(this).attr("id"))
//		console.log(w)
//		console.log(n)
	});	
    
    
    
  });
  </script>
</head>
<body>
 
<ul id="sortable1" class="connectedSortable">
  <li class="ui-state-default">Item 1</li>
  <li class="ui-state-default">Item 2</li>
  <li class="ui-state-default">Item 3</li>
  <li class="ui-state-default">Item 4</li>
  <li class="ui-state-default">Item 5</li>
</ul>
 
<ul id="sortable2" class="connectedSortable">
  <li class="ui-state-highlight">Item 1</li>
  <li class="ui-state-highlight">Item 2</li>
  <li class="ui-state-highlight">Item 3</li>
  <li class="ui-state-highlight">Item 4</li>
  <li class="ui-state-highlight">Item 5</li>
</ul>
 
 
</body>
</html>